package cn.itcast.dewu.config;

import cn.itcast.dewu.dto.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
//异常处理类
public class WebExceptionAdvice {
    @ExceptionHandler(RuntimeException.class)
    public Result exception(RuntimeException runtimeException) {
        log.error(runtimeException.toString(),runtimeException);
        return Result.fail("服务器异常,请联系管理员");
    }
}
